# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-exchangelib
_pkgname=${pkgname#python-}
pkgver=5.4.3
pkgrel=3
pkgdesc='Exchange Web Services client library.'
arch=('any')
url='https://github.com/ecederstrand/exchangelib'
license=('BSD')
depends=('python-cached-property' 'python-dnspython' 'python-oauthlib'
         'python-defusedxml' 'python-isodate' 'python-lxml' 'python-pygments'
         'python-pytzdata' 'python-tzlocal' 'python-requests-ntlm'
         'python-requests-oauthlib')
makedepends=('python-build' 'python-pip')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('4e5a1920ee14ea760c0cb4c1b72a26acf710f1c5b5e77bb83818d376bccc42349debae8728f1f68600dfe1ca2afa666cf8924479ebe1e6d9a5ef23a74fb1a52e')

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd "$_pkgname-$pkgver"


  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    "$_pkgname"

  cd $srcdir/"$_pkgname-$pkgver"

  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

